package com.logistics.modules.sys.controller;

import java.util.Arrays;
import java.util.Map;

import com.logistics.modules.sys.entity.FreightcalculaterulesEntity;
import com.logistics.modules.sys.service.FreightcalculaterulesService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.logistics.common.utils.PageUtils;
import com.logistics.common.utils.R;



/**
 * 
 *
 * @author HURRICANE
 * @email HURRICANE@nb.com
 * @date 2022-05-06 16:47:20
 */
@RestController
@RequestMapping("sys/freightcalculaterules")
public class FreightcalculaterulesController {

    @Autowired
    private FreightcalculaterulesService freightcalculaterulesService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("sys:freightcalculaterules:list")
    public R list(@RequestParam Map<String, Object> params){

        PageUtils page = freightcalculaterulesService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("sys:freightcalculaterules:info")
    public R info(@PathVariable("id") Integer id){

		FreightcalculaterulesEntity freightcalculaterules = freightcalculaterulesService.getById(id);

        return R.ok().put("freightcalculaterules", freightcalculaterules);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("sys:freightcalculaterules:save")
    public R save(@RequestBody FreightcalculaterulesEntity freightcalculaterules){

		freightcalculaterulesService.insertByOne(freightcalculaterules);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("sys:freightcalculaterules:update")
    public R update(@RequestBody FreightcalculaterulesEntity freightcalculaterules){

		freightcalculaterulesService.updateById(freightcalculaterules);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("sys:freightcalculaterules:delete")
    public R delete(@RequestBody Integer[] ids){

		freightcalculaterulesService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
